/*
 * Copyright (c) 2022 Winsider Seminars & Solutions, Inc.  All rights reserved.
 *
 * This file is part of System Informer.
 *
 * Authors:
 *
 *     wj32    2015
 *     dmex    2015-2024
 *
 */

#ifndef _TOOLSTATUSINTF_H
#define _TOOLSTATUSINTF_H

#define TOOLSTATUS_INTERFACE_NAME L"ProcessHacker.ToolStatus"
#define TOOLSTATUS_INTERFACE_VERSION 2

typedef _Function_class_(TOOLSTATUS_GET_SEARCH_MATCH_HANDLE)
ULONG_PTR NTAPI TOOLSTATUS_GET_SEARCH_MATCH_HANDLE(
    VOID
    );
typedef TOOLSTATUS_GET_SEARCH_MATCH_HANDLE* PTOOLSTATUS_GET_SEARCH_MATCH_HANDLE;

typedef _Function_class_(TOOLSTATUS_WORD_MATCH)
BOOLEAN NTAPI TOOLSTATUS_WORD_MATCH(
    _In_ PCPH_STRINGREF Text
    );
typedef TOOLSTATUS_WORD_MATCH* PTOOLSTATUS_WORD_MATCH;

typedef _Function_class_(TOOLSTATUS_REGISTER_TAB_SEARCH)
VOID NTAPI TOOLSTATUS_REGISTER_TAB_SEARCH(
    _In_ LONG TabIndex,
    _In_ PCPH_STRINGREF BannerText
    );
typedef TOOLSTATUS_REGISTER_TAB_SEARCH* PTOOLSTATUS_REGISTER_TAB_SEARCH;

typedef _Function_class_(TOOLSTATUS_TAB_ACTIVATE_CONTENT)
VOID NTAPI TOOLSTATUS_TAB_ACTIVATE_CONTENT(
    _In_ BOOLEAN Select
    );
typedef TOOLSTATUS_TAB_ACTIVATE_CONTENT* PTOOLSTATUS_TAB_ACTIVATE_CONTENT;

typedef _Function_class_(TOOLSTATUS_GET_TREENEW_HANDLE)
HWND NTAPI TOOLSTATUS_GET_TREENEW_HANDLE(
    VOID
    );
typedef TOOLSTATUS_GET_TREENEW_HANDLE* PTOOLSTATUS_GET_TREENEW_HANDLE;

typedef struct _TOOLSTATUS_TAB_INFO
{
    ULONG Index;
    PCPH_STRINGREF BannerText;
    PTOOLSTATUS_TAB_ACTIVATE_CONTENT ActivateContent;
    PTOOLSTATUS_GET_TREENEW_HANDLE GetTreeNewHandle;
} TOOLSTATUS_TAB_INFO, *PTOOLSTATUS_TAB_INFO;

typedef _Function_class_(TOOLSTATUS_REGISTER_TAB_INFO)
PTOOLSTATUS_TAB_INFO NTAPI TOOLSTATUS_REGISTER_TAB_INFO(
    _In_ LONG TabIndex,
    _In_opt_ PCPH_STRINGREF BannerText
    );
typedef TOOLSTATUS_REGISTER_TAB_INFO* PTOOLSTATUS_REGISTER_TAB_INFO;

#define TOOLSTATUS_GRAPH_ENABLED 0x1
#define TOOLSTATUS_GRAPH_UNAVAILABLE 0x2

typedef struct _PH_PLUGIN* PPH_PLUGIN;

typedef _Function_class_(TOOLSTATUS_GRAPH_CALLBACK)
BOOLEAN NTAPI TOOLSTATUS_GRAPH_CALLBACK(
    _In_ HWND WindowHandle,
    _In_ ULONG Message,
    _In_opt_ PVOID Parameter1,
    _In_opt_ PVOID Parameter2,
    _In_opt_ PVOID Context
    );
typedef TOOLSTATUS_GRAPH_CALLBACK* PTOOLSTATUS_GRAPH_CALLBACK;

typedef _Function_class_(TOOLSTATUS_GRAPH_MESSAGE_CALLBACK)
VOID NTAPI TOOLSTATUS_GRAPH_MESSAGE_CALLBACK(
    _In_ PVOID Graph,
    _In_ HWND GraphHandle,
    _In_ PPH_GRAPH_STATE GraphState,
    _In_ LPNMHDR Header,
    _In_opt_ PVOID Context
    );
typedef TOOLSTATUS_GRAPH_MESSAGE_CALLBACK* PTOOLSTATUS_GRAPH_MESSAGE_CALLBACK;

typedef _Function_class_(TOOLSTATUS_REGISTER_TOOLBAR_GRAPH)
VOID NTAPI TOOLSTATUS_REGISTER_TOOLBAR_GRAPH(
    _In_ PPH_PLUGIN Plugin,
    _In_ ULONG Id,
    _In_ PWSTR Text,
    _In_ ULONG Flags,
    _In_opt_ PVOID Context,
    _In_ PTOOLSTATUS_GRAPH_CALLBACK GraphCallback
    );
typedef TOOLSTATUS_REGISTER_TOOLBAR_GRAPH* PTOOLSTATUS_REGISTER_TOOLBAR_GRAPH;

typedef struct _PH_TOOLBAR_GRAPH
{
    PPH_PLUGIN Plugin;

    ULONG Flags;
    ULONG GraphId;
    LONG GraphDpi;
    ULONG GraphColor1;
    ULONG GraphColor2;

    HWND GraphHandle;
    PVOID Context;
    PWSTR Text;

    PH_GRAPH_STATE GraphState;
    PTOOLSTATUS_GRAPH_MESSAGE_CALLBACK MessageCallback;
    PTOOLSTATUS_GRAPH_CALLBACK GraphCallback;
} PH_TOOLBAR_GRAPH, *PPH_TOOLBAR_GRAPH;

typedef struct _TOOLSTATUS_INTERFACE
{
    ULONG Version;
    PTOOLSTATUS_GET_SEARCH_MATCH_HANDLE GetSearchMatchHandle;
    PTOOLSTATUS_WORD_MATCH WordMatch;
    PTOOLSTATUS_REGISTER_TAB_SEARCH RegisterTabSearchDeprecated;
    PPH_CALLBACK SearchChangedEvent;
    PTOOLSTATUS_REGISTER_TAB_INFO RegisterTabInfo;
    PTOOLSTATUS_REGISTER_TOOLBAR_GRAPH RegisterToolbarGraph;
} TOOLSTATUS_INTERFACE, *PTOOLSTATUS_INTERFACE;

#endif
